home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Monster Media 1996 #14
/
Monster Media No. 14 (April 1996) (Monster Media, Inc.).ISO
/
maximus
/
fdomore.zip
/
FDOMORE.MEX
next >
Wrap
Text File
|
1996-02-19
|
7KB
|
162 lines
//--------------------------------------------------------------------------//
// FileDoMore v1.0 for Maximus v3 //
// by Chris Gerlinsky, 1:140/186 //
// //
// This is a MEX to be used after a list of files is shown to the user, it //
// will display More [Y,n,t,=]? prompt just as in the files listing, and //
// will allow users to tag files, etc.. //
// //
// If you've tried Press_Enter and [more] commands for this purpose, you've //
// likely noticed that if a user selects n at a no prompt, they will get an //
// extra prompt - this should stop that from happening.. //
// //
// In your language file [ENGLISH.MAD], you must change the file_stats line //
// to read as the following: //
// @MEX file_stats= "(%u) %-12s (%02u:%02u, %ld bytes)" //
// (colours are OK, but there must be the @MEX, and the %u, %-12s, //
// %02u (both), and %ld must be left alone) //
// //
// Call this as in the following:(also suggested for locate, newfiles, etc) //
// File_Titles Demoted "File titles" //
// NoDsp MEX M\Fdomore Demoted "File titles" //
// //
// Thanks to Michael Nix (3:690/426) for pointing me towards xfertime()! //
//--------------------------------------------------------------------------//
#include <max.mh>
#include <max_menu.mh>
#define INCL_global
#define INCL_f_area
#include <language.mh>
void main()
{
char: nonstop;
int: inchar,numoftagged,flags,semiloc,mins,secs;
string: Yne,le_more_prompt,instr,file_stats,filename,holder;
nonstop:=0;
Yne:=str_MoreYnTag;
le_more_prompt:=str_more_prompt;
le_more_prompt[strlen(le_more_prompt)+1]:=' ';
le_more_prompt[strlen(le_more_prompt)+1]:='[';
le_more_prompt[strlen(le_more_prompt)+1]:=Yne[1];
le_more_prompt[strlen(le_more_prompt)+1]:=',';
le_more_prompt[strlen(le_more_prompt)+1]:=Yne[2];
le_more_prompt[strlen(le_more_prompt)+1]:=',';
le_more_prompt[strlen(le_more_prompt)+1]:=Yne[3];
le_more_prompt[strlen(le_more_prompt)+1]:=',';
le_more_prompt[strlen(le_more_prompt)+1]:=Yne[4];
le_more_prompt[strlen(le_more_prompt)+1]:=']';
le_more_prompt[strlen(le_more_prompt)+1]:='?';
le_more_prompt[strlen(le_more_prompt)+1]:=' ';
if(sys.more_lines<2)
return;
donehit:
inchar:=input_ch(CINPUT_DISPLAY|CINPUT_PROMPT|CINPUT_NOLF,le_more_prompt);
while(tolower(inchar)<>tolower(Yne[1]) and tolower(inchar)<>tolower(Yne[2]) and tolower(inchar)<>tolower(Yne[3]) and tolower(inchar)<>tolower(Yne[4]) and inchar<>13 and inchar<>'|')
{
inchar:=input_ch(CINPUT_DISPLAY|CINPUT_PROMPT|CINPUT_NOLF,str_useyforyesnst+le_more_prompt);
}
if(tolower(inchar)=Yne[3])
{
print('\r',AVATAR_CLEOL);
numoftagged:=tag_queue_size();
input_str(instr,INPUT_NLB_LINE|INPUT_NOLF,0,256,"("+itostr(numoftagged+1)+") Filename to tag? ");
if(strlen(instr)>0)
input:="a"+instr;
else
goto notag;
set_output(DISABLE_BOTH);
menu_cmd(MNU_FILE_TAG,"");
set_output(DISABLE_NONE);
notag:
if(numoftagged<tag_queue_size())
{
while(numoftagged<tag_queue_size())
{
numoftagged:=numoftagged+1;
file_stats:=str_file_stats;
semiloc:=strfind(file_stats,"%u");
if(semiloc)
{
holder:=substr(file_stats,semiloc+2,strlen(file_stats)-semiloc-1);
file_stats:=substr(file_stats,1,semiloc-1);
file_stats:=file_stats+itostr(numoftagged)+holder;
}
semiloc:=strfind(file_stats,"%ld");
if(semiloc)
{
holder:=substr(file_stats,semiloc+3,strlen(file_stats)-semiloc-1);
file_stats:=substr(file_stats,1,semiloc-1);
tag_get_name(numoftagged-1,flags,filename);
file_stats:=file_stats+ltostr(filesize(filename))+holder;
}
secs:=xfertime(usr.def_proto,filesize(filename))%60;
mins:=xfertime(usr.def_proto,filesize(filename))/60;
semiloc:=strfind(file_stats,"%02u");
if(semiloc)
{
holder:=substr(file_stats,semiloc+4,strlen(file_stats)-semiloc-1);
file_stats:=substr(file_stats,1,semiloc-1);
if(mins>9)
file_stats:=file_stats+itostr(mins)+holder;
else
file_stats:=file_stats+"0"+itostr(mins)+holder;
}
semiloc:=strfind(file_stats,"%02u");
if(semiloc)
{
holder:=substr(file_stats,semiloc+4,strlen(file_stats)-semiloc-1);
file_stats:=substr(file_stats,1,semiloc-1);
if(secs>9)
file_stats:=file_stats+itostr(secs)+holder;
else
file_stats:=file_stats+"0"+itostr(secs)+holder;
}
semiloc:=strfind(file_stats,"%-12s");
if(semiloc)
{
holder:=substr(file_stats,semiloc+5,strlen(file_stats)-semiloc-1);
file_stats:=substr(file_stats,1,semiloc-1);
filename:=substr(filename,strridx(filename,0,'\\')+1,12);
file_stats:=file_stats+filename+holder;
}
print('\r',AVATAR_CLEOL,file_stats);
}
}
else
{
if(strlen(instr)>0)
print('\r',AVATAR_CLEOL,COL_LRED,"Unable to tag file \"",instr,"\".\n",COL_WHITE);
else
print('\r',AVATAR_CLEOL);
}
goto donehit;
}
return;
}